#include<stdio.h>
#include<stdlib.h>
#include<time.h>
#include<string.h>


int main(int argc,const char* argv[]){
    if(argc != 2){
        return -1;
    }
    FILE*fp = fopen(argv[1],"r");
    if(fp == NULL){
        printf("fopen err\n");
        return -1;
    }

//
    char ch[32]={0};
    int len=sizeof(ch)/sizeof(ch[0]);
    int n=0;
    while(1){
        
        if(fgets(ch,len,fp) == NULL){
            n++;
            break;
        }
        if(ch[(strlen(ch))-1] == '\n'){
            n++;
        }
    }
    printf("有%d行\n",n);

    fclose(fp);
    fp=NULL;
    return 0;
}